#include "category.h"

#include <QXmlStreamReader>

Widget::Widget(const QString &name,const QString &c,const QIcon &icon):
    m_name(name),
    m_icon(icon),
    m_class(c)
{
}

void Widget::setIcon(const QIcon &icon)
{
    m_icon=icon;
}

void Widget::setName(const QString &name)
{
    m_name=name;
}

void Widget::setClassName(const QString &c)
{
    m_class=c;
}

QString Widget::name() const
{
    return m_name;
}

QString Widget::className()const
{
    return m_class;
}

QIcon Widget::icon() const
{
    return m_icon;
}

void Widget::setPluginName(const QString &pluginName)
{
    m_pluginName=pluginName;
}

QString Widget::pluginName()
{
    return m_pluginName;
}

bool Widget::isNull()
{
    return m_name.isEmpty();
}

Category::Category(const QString &name):
    m_name(name)
{
}

QString Category::name() const
{
    return m_name;
}

void Category::setName(const QString &name)
{
    m_name=name;
}

Widget Category::widget(int idx) const
{
    if(idx<0 || idx>=m_widget_list.size())
    {
        return Widget();
    }
    return m_widget_list.at(idx);
}

int Category::widgetCount() const
{
    return m_widget_list.size();
}

void Category::addWidget(const Widget &widget)
{
    m_widget_list.append(widget);
}
